package controller.common;

import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class CommonController {
    private static final Logger logger = LoggerFactory.getLogger(CommonController.class);

    @RequestMapping(value = "/mapResources")
    public String mapResources() {
        return "mapResources";
    }

    @RequestMapping(value = "/eventReporting")
    public String eventReporting() {
        return "eventReporting";
    }

    @RequestMapping(value = "/statisticalInfor-facilities")
    public String statisticalInforFacilities() {
        return "statisticalInfor-facilities";
    }

    @RequestMapping(value = "/statisticalInfor-company")
    public String statisticalInforCompany() {
        return "statisticalInfor-company";
    }

    @RequestMapping(value = "/statisticalInfor-base")
    public String statisticalInforBase() {
        return "statisticalInfor-base";
    }

    @RequestMapping(value = "/statisticalInfor-vehicle")
    public String statisticalInforVehicle() {
        return "statisticalInfor-vehicle";
    }

    @RequestMapping(value = "/statisticalInfor-plan")
    public String statisticalInforPlan() {
        return "statisticalInfor-plan";
    }

    @RequestMapping(value = "/eventReporting-add")
    public String eventReportingAdd() {
        return "eventReporting-add";
    }

    @RequestMapping(value = "/statisticalInfor-company-child")
    public String statisticalInforCompanyChild(HttpServletRequest request, String t) {
        request.setAttribute("t", t);
        return "statisticalInfor-company-child";
    }

    @RequestMapping(value = "/dayMaintenance-list")
    public String dayMaintenanceList() {
        return "dayMaintenance-list";
    }

    @RequestMapping(value = "/eventReporting-list")
    public String eventReportingList() {
        return "eventReporting-list";
    }

    @RequestMapping(value = "/dayMaintenance")
    public String dayMaintenance() {
        return "dayMaintenance";
    }

    @RequestMapping(value = "/eventReporting-content")
    public String eventReportingContent() {
        return "eventReporting-content";
    }

    @RequestMapping(value = "/baiduMap")
    public String baiduMap() {
        return "baiduMap";
    }


    @RequestMapping(value = "/demo")
    public String demo() {
        return "demo";
    }


    public void getToken() throws Exception {
        String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=ww0e7be2a6a0200924&corpsecret=mfL3J4oMtcksZMamflXcxqtGnU7m1oIFq944wxf7kHI";
        ClientRequest request = new ClientRequest(url);
        request.accept("application/json");
        ClientResponse<String> response = request.get(String.class);
        String responseContent = (String) response.getEntity();
        System.out.println(responseContent);
    }

}
